<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Using the JDBC Driver in ADF Mobile for Android</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB Installation and Build Guide" />
    <link rel="up" href="build_android_intro.html" title="Chapter 4. Building Berkeley DB for Android" />
    <link rel="prev" href="build_android_config.html" title="Android Configuration Options" />
    <link rel="next" href="build_win.html" title="Chapter 5.  Building Berkeley DB for Windows" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 12.1.6.2</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Using the JDBC Driver in ADF Mobile for Android</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="build_android_config.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 4. Building Berkeley DB for
        Android</th>
          <td width="20%" align="right"> <a accesskey="n" href="build_win.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="build_android_adfmobile"></a>Using the JDBC Driver in ADF Mobile for Android</h2>
          </div>
        </div>
      </div>
      <p> 
        This section describes how to build and use BDB JDBC
        driver for Android in ADF Mobile. 
    </p>
      <div class="orderedlist">
        <ol type="1">
          <li>
            <p> 
                Setup the ADF Mobile environments: 
            </p>
            <div class="itemizedlist">
              <ul type="disc">
                <li>
                  <p>
                ADF Business Components: 11.1.2.4.39.64.36.1
                </p>
                </li>
                <li>
                  <p>
                ADF Mobile Framework: 11.1.2.4.39.64
                </p>
                </li>
                <li>
                  <p>
                JDeveloper: 11g Release 2(11.1.2.4.0)
                </p>
                </li>
              </ul>
            </div>
          </li>
          <li>
            <p>
                Prepare the building environment. 
            </p>
            <div class="orderedlist">
              <ol type="a">
                <li>
                  <p>
            Download the OJEC1.1.1 headless package from 
            </p>
                  <p>
                <a class="ulink" href=" http://www.oracle.com/technetwork/java/embedded/downloads/javame/index.html#2" target="_top"> http://www.oracle.com/technetwork/java/embedded/downloads/javame/index.html#2</a>
            </p>
                  <p>
             Unzip it and move btclasses.zip from OJEC1.1.1_HOME to OJEC1.1.1_HOME/lib.
            </p>
                </li>
                <li>
                  <p>
            Modify BDB_HOME/lang/sql/jdbc/config.ojec11 as follows:
            </p>
                  <div class="itemizedlist">
                    <ul type="disc">
                      <li>
                        <p>
            Specify OJEC_HOME with the location where OJEC1.1.1 is unzipped to
            </p>
                      </li>
                      <li>
                        <p>
            Specify JDBCSQLITE_HOME with BDB_HOME/build_unix/jdbc
            </p>
                      </li>
                      <li>
                        <p>
            Remove foundation.jar from BOOT_CLASSPATH
            </p>
                      </li>
                      <li>
            Remove the last line which is "./configure"
            </li>
                    </ul>
                  </div>
                </li>
                <li>
                  <p>
            Export the variables in config.ojec11 to the environment using an appropriate
            shell command for example, ". BDB_HOME/lang/sql/jdbc/config.ojec11".
            </p>
                </li>
              </ol>
            </div>
          </li>
          <li>
            <p>
                Build the Android JDBC driver. 
            </p>
            <p> 
                For instructions on how to build Android JDBC driver, 
                see <a class="xref" href="build_android_jdbc.html" title="Building the Android JDBC Driver">Building the Android JDBC
        Driver</a>.
            </p>
            <p>
            Ensure that the JDBC driver includes SQLite/JDBC0 classes by "jar tf sqlite.jar".
            </p>
          </li>
          <li>
            <p>
            Apply Android JDBC in ADF Mobile.
            </p>
            <div class="orderedlist">
              <ol type="a">
                <li>
                  <p>
            Download the ADF Mobile in JDeveloper by selecting
            Help -&gt; Check for Updates. The ADF Mobile extension will be downloaded in
            jdev_install/jdeveloper/jdev/extensions/oracle.adf.mobile.
            </p>
                </li>
                <li>
                  <p>
            In JDeveloper, open the HR sample application in 
            jdev_install/jdeveloper/jdev/extensions/oracle.adf.mobile/Samples/HR.
            </p>
                </li>
                <li>
                  <p>
            Add BDB Android JDBC to application libraries and classpath.
            </p>
                </li>
                <li>
                  <p>
             Replace the JDBC driver in ADF Mobile framework as follows.
            </p>
                  <pre class="programlisting">
$ cd jdev_install/jdeveloper/jdev/extensions/oracle.adf.mobile
/Android
$ unzip Oracle_ADFmf_Framework.zip
...
$ cp &lt;db&gt;/build_unix/jdbc/sqlite.jar ./framework/Android/build/
java_res_&lt;release and debug&gt;/assets/storage/jvm/lib/
$ cp &lt;db&gt;/build_android/jdbc/libs/armeabi/liboracle-jdbc.so .
/framework/Android/build/java_res_&lt;release and debug&gt;/assets/storage
/jvm/lib/
$ zip -9 -r Oracle_ADFmf_Framework.zip framework
...
$ rm -fr framework
</pre>
                </li>
              </ol>
            </div>
          </li>
          <li>
            <p>
            Modify the sample application.
            </p>
            <div class="orderedlist">
              <ol type="a">
                <li>
                  <p>
                  Migrate the database file from SQLite to BDB by the following commands:
                  </p>
                  <pre class="programlisting">
$ cd HR_SAMPLE/.adf/META-INF
$ mv HR.db HR.db.orig
$ mv hr.sql hr.sql.orig
$ vi hr.sql (Remove all lines with "COMMIT" and "REM") $ 
BDB_HOME/build_unix/dbsql HR.db
.read hr.sql
.exit
</pre>
                </li>
                <li>
                  <p>
               Modify LifeCycleListernImpl.start() method by replacing the try
               catch block of getting a connection and executing the query with copyDB().
               </p>
                </li>
              </ol>
            </div>
          </li>
          <li>
            <p>
                Run the sample application.
            </p>
            <div class="orderedlist">
              <ol type="a">
                <li>
                  <p>
            Configure the ADF Mobile preferences for Android. 
            Select Tools -&gt; Preferences -&gt; ADF Mobile -&gt; Platforms -&gt; Android.
            Specify the locations of Android SDK, Android platform, and the 
            keystore in the Release mode which is used to sign on the application.
            </p>
                </li>
                <li>
                  <p>
            Create a deployment profile. Select Application -&gt; Deploy -&gt; New Deployment Profile.
            Choose ADF Mobile for Android as profile type. In the form of deployment profile 
            properties, choose Release Mode.
            </p>
                </li>
                <li>
                  <p>
            Launch the Android SDK Manager and start the AVD emulator.
            </p>
                </li>
                <li>
                  <p>
            Deploy the application by selecting Application -&gt; deploy -&gt; 
            (the_just_created_deployment_profile). Before deployment, ensure that the folder HR_SAMPLE/deploy is removed.
            </p>
                </li>
                <li>
                  <p>
            Run the application by clicking the application icon in the emulator.
            </p>
                </li>
              </ol>
            </div>
          </li>
        </ol>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="build_android_config.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="build_android_intro.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="build_win.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Android Configuration
        Options </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Chapter 5.  Building Berkeley DB for Windows </td>
        </tr>
      </table>
    </div>
  </body>
</html>
